package nc;

import java.util.Scanner;

/**
 * 功能:等差数列 2，5，8，11，14。。。。
 *
 * 输入:正整数N >0
 *
 * 输出:求等差数列前N项和
 *
 * 返回:转换成功返回 0 ,非法输入与异常返回-1
 */
public class Q21323 {


    public static int sum(int n) {
        if (n<1) {
            return 0;
        }
        int sum = 2;
        if (n == 1) {
            return 2;
        } else {
            for (int i = 2; i <= n; i++) {
                sum = sum + i * 3 - 1;
            }
        }
        return sum;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            final int i = scanner.nextInt();
            System.out.println(sum(i));
        }
    }

}
